perm filename EXP09[106,RWF] blob
sn#776336 filedate 1984-11-12 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 Exercise in File and Terminal Handling (P09.PGO)
C00006 ENDMK
Cā;
Exercise in File and Terminal Handling (P09.PGO)
Your program is to perform a payroll computation, using data from two files
and from the terminal keyboard and print results on two other files and the
terminal screen.
(Input)file 1 contains, on each line, the name of an employee in a 20-character
field; the employee's hourly pay rate as a REAL number; and the employee's
cumulative as a REAL.
(Input)file 2 contains, on each line, the name of an employee in a 20-character
field, and the employee's total hours worked for the current pay period. Both
input files are alphabetized by employee name. Both have a sentinel last line
with the ``employee name'' zzzzzzzzzzzzzzzzzzzz (20 z's) and nothing else.
(Input)file 3 is to be like file 1, with the gross pay increased to include
the current pay period.
(Output)file 4 is to be like file 2, with each employee line extended to show
gross pay for the current pay period, and social security deduction. After
the sentinel line, file 4 should contain a summary line totalling the gross
pay and social security deductions for everyone.
The program should ask the user at the terminal for the current social
security rate, and for the maximum gross pay to which social security
withholding applies. Gross pay for a pay period is simply pay rate times
hours worked. Social security deduction for a pay period is the social
security rate times the gross pay, except that (cumulative) gross pay beyond
the social security maximum is not taxed for social security.
There may be names in either file that are not in the other. Names in file 1
but not in file 2 are assumed to be on vacation or the like; they continue
unchanged on file 3. Names in file 2 but not in file 1 are errors; no entry
is made for them in file 3, but file 4 should contain the name and an error
message.
The terminal input should be prompted, checked, and reread until valid.
The social security rate must be between 0.0 and 1.0, and the social security
maximum can not be negative.
You will find the data on files <CLASSES.CS106>P09D1.DAT and <CLASSES.CS106>
P09D2.DAT; use a social security rate of 0.07 and a maximum of 20000 dollars.
Suggestion: First get the program working without terminal input, using
constants for the social security parameters.